﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OperaHouse.Business.Users;
using OperaHouse.Domain.Users;
using OperaHouse.Web.Models;

namespace OperaHouse.Web.Controllers
{
    public partial class UserController : Controller
    {
        #region Fields
        private readonly IUserService _userService;
        #endregion

        #region Ctor
        public UserController(IUserService userService)
        {
            this._userService = userService;
        }
        #endregion

        #region Action
        public ActionResult Index()
        {
            IList<UserModel> userModels = new List<UserModel>();
            var users = _userService.GetAllUsers();
            foreach (var user in users.ToList())
            {
                userModels.Add(UserModel.Create(user));
            }

            return View(userModels);
        }
        #endregion
    }
}
